home *** CD-ROM | disk | FTP | other *** search
/ HamCall (April 1991) / HAMCALL CD-ROM (Buckmaster)(April 1991).BIN / prgming / tctut / printdat.c < prev    next >
C/C++ Source or Header  |  1990-10-14  |  615b  |  23 lines

  1.                                         /* Chapter 10 - Program 8 */
  2. #include "stdio.h"
  3.  
  4. main()
  5. {
  6. FILE *funny,*printer;
  7. char c;
  8.  
  9.    funny = fopen("TENLINES.TXT","r"); /* open input file     */
  10.    printer = fopen("PRN","w");        /* open printer file   */
  11.  
  12.    do {
  13.       c = getc(funny);    /* get one character from the file */
  14.       if (c != EOF) {
  15.          putchar(c);      /* display it on the monitor       */
  16.          putc(c,printer); /* print the character             */
  17.       }
  18.    } while (c != EOF);    /* repeat until EOF (end of file)  */
  19.  
  20.    fclose(funny);
  21.    fclose(printer);
  22. }
  23.